#include <panel.h>
#include <cstdlib>
#include "object.h"

extern WINDOW* mapwin;
extern PANEL* mappan;

void Object::Cursor(){
	wmove(mapwin,row,col);
}
void Object::Draw(){
	wmove(mapwin,row,col);
	if(color > 7){
		wattron(mapwin,A_BOLD);
		wattron(mapwin,COLOR_PAIR(color-8));
	}
	else{
		wattron(mapwin,COLOR_PAIR(color));
	}
	waddch(mapwin,symbol);
	if(color > 7){
		wattroff(mapwin,A_BOLD);
		wattroff(mapwin,COLOR_PAIR(color-8));
	}
	else{
		wattroff(mapwin,COLOR_PAIR(color));
	}
}
int Object::DistanceFrom(int r,int c){
	int dy = abs(r - row);
	int dx = abs(c - col);
	if(dx > dy){
		return dx;
	}
	else{
		return dy;
	}
}

